home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 277 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: news.shentel.net!Global-PPP
  2. From: scicom@globalcom.net (stephen j beaver)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: prefix vs. postfix
  5. Date: Wed, 03 Jan 96 23:18:05 GMT
  6. Organization: scicom research us inc
  7. Distribution: world
  8. Message-ID: <4cf35v$7il@head.globalcom.net>
  9. References: <4c1089$gro@nntpd2.cxo.dec.com> <tcpnntpd.15.12.30.11.27.18.2781597121.305087@the-fix.sos.on.ca> <30DEC199514333959@erich.triumf.ca>
  10. NNTP-Posting-Host: eb3ppp26.shentel.net
  11. X-Newsreader: News Xpress Version 1.0 Beta #2
  12.  
  13. <SNIP>
  14.  
  15. >The two operators _never_ do the same thing.  However, if you just want the
  16. >side effect of the increment, but the value returned by i++ or ++i is not used,
  17. >(as in for(i = 0; i < 10; i++) ) it doesn't matter which is used.
  18.  
  19. I thought that:
  20.  
  21. for(i=0;i<10;i++)
  22.    {
  23.    loopbody(i):
  24.    }
  25.  
  26. Increments i after the loop so that the first value passed to loopbody() is zero, whereas:
  27.  
  28. for(i=0;i<10;++i)
  29.    {
  30.   loopbody();
  31.    }
  32.  
  33. increments i before the loop body so that the first value passedtp loopbody() is 1 in this case.
  34.  
  35. No?
  36.  
  37. Steve
  38. >
  39.